﻿CREATE procedure dbo.CancelTakeout

	(
		@TakeoutUserID int

	)

AS
	/* SET NOCOUNT ON */
	
	DECLARE @TakeoutProviderID int
	
	SET @TakeoutProviderID = (SELECT TakeoutProviderID From dbo.TakeoutUser WHERE Id = @TakeoutUserID)
		
	DELETE FROM dbo.TakeoutUser
	WHERE     (Id = @TakeoutUserID)



	UPDATE    dbo.TakeoutProvider
		SET              MaximumOrders = (MaximumOrders + 1)
		WHERE     (Id = @TakeoutProviderID)
	
	
	
	RETURN


